# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=libretro-dolphin
pkgver=0_git20220407
pkgrel=1
_commit="6a0b6ee8a4d5363e669f5faf43abc8f17e4278a8"
pkgdesc="libretro core for dolphin"
url="https://github.com/libretro/dolphin"
arch="aarch64 x86_64"
license="GPL-2.0-or-later"
makedepends="
	alsa-lib-dev
	bzip2-dev
	cmake
	eudev-dev
	libusb-dev
	libxi-dev
	libxrandr-dev
	mbedtls-dev
	mesa-dev
	xz-dev
	zlib-dev
	"
source="$pkgname-$_commit.tar.gz::https://github.com/libretro/dolphin/archive/$_commit.tar.gz"
builddir="$srcdir/dolphin-$_commit"
options="!check" # No tests

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None \
		-DLIBRETRO=On \
		-DLIBRETRO_STATIC=1 \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

package() {
	install -Dm644 build/dolphin_libretro.so \
		"$pkgdir"/usr/lib/libretro/dolphin_libretro.so
}

sha512sums="
f0e030fb3272f2e5f2a57a55bf908c0d75559af49f7a97971acc4efd7f5be1ec3347e4f40923559ea61919bd4b4ea2e3abab571f0df5accd5e16529403609675  libretro-dolphin-6a0b6ee8a4d5363e669f5faf43abc8f17e4278a8.tar.gz
"
